from time import *
with open('m1_sorted.txt') as f:
    a_1 = [int(x) for x in f]
with open('m2_reverse.txt') as f:
    a_2 = [int(x) for x in f]
with open('m3_shuffle.txt') as f:
    a_3 = [int(x) for x in f]
def bubble_gum(a):
    for i in range(len(a) - 1):
        flag = False
        for j in range(len(a) - 1 - i):
            if a[j] > a[j + 1]:
                a[j], a[j + 1] = a[j + 1], a[j]
                flag = True
        if flag == False:
            break
    return a
start = time()
bubble_gum(a_1)
finish = time()
print('m1_sorted.txt', round((finish - start) * 1000), 'milliseconds')
start = time()
bubble_gum(a_2)
finish = time()
print('m2_reverse.txt', round((finish - start) * 1000), 'milliseconds')
start = time()
bubble_gum(a_3)
finish = time()
print('m3_shuffle.txt', round((finish - start) * 1000), 'milliseconds')
